home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / archival / ftp / holefixes / fingerfix next >
Encoding:
Internet Message Format  |  1988-11-10  |  10.2 KB

  1. Date: Fri, 4 Nov 88 14:20:14 PST
  2. From: bostic@okeeffe.Berkeley.EDU (Keith Bostic)
  3. To: phage@purdue.edu
  4. Subject: last one...
  5.  
  6. Subject: Virus (really worm) posting #4
  7. Index: usr.lib/sendmail/src/srvrsmtp.c 4BSD
  8.  
  9. Description:
  10.     This is hopefully the final posting we'll make regarding
  11.     the worm that was released onto the Internet.  MIT (as I
  12.     understand it, a combination of people from Project Athena,
  13.     the Lab for Computer Services, the Networking Group, and
  14.     SIPB), and members of the Berkeley UNIX Workshop have both
  15.     decompiled copies of the worm (into about 2000 lines of C).
  16.  
  17.     As of this time, we believe that there were three methods
  18.     of attack; exploiting software bugs in sendmail and fingerd,
  19.     and by guessing (albeit fairly intelligently) passwords.
  20.     We believe that the fixes already posted for sendmail and
  21.     fingerd are sufficient to stop the worm from entering your
  22.     system; as far as guessing passwords, there's not much you
  23.     can do but educate your users.  We also recommend renaming
  24.     ``/bin/ld'' for the next few days, meanwhile checking your
  25.     machines for occurrences of the worm.  This should keep it
  26.     from moving around on your local nets.
  27.  
  28.     We are reposting fingerd(8), since it apparently got munged
  29.     before arriving at some sites.  
  30.  
  31.     Complete copies of all postings regarding the worm are
  32.     available by anonymous ftp from ucbvax.berkeley.edu and
  33.     ucbarpa.berkley.edu, as ``pub/virus.patch''.
  34.     
  35.     We believe that the virus cannot be propagated by uucp.
  36.  
  37.     In the Berkeley tradition of fixing other people's software,
  38.     and in the general interests of software portability and
  39.     matainability, we have provided three fixes for those
  40.     individuals wishing to continue to run the worm on their
  41.     systems.  To apply theses fixes, discompile the worm 
  42.     and then use patch.
  43.  
  44.     Note: 
  45.         THESE FIXES ARE PROVIDED ``AS IS'' AND WITHOUT ANY
  46.         EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
  47.         LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY
  48.         AND FITNESS FOR A PARTICULAR PURPOSE.
  49.  
  50. *** if_init.c.old    Fri Nov  4 14:01:54 1988
  51. --- if_init.c    Fri Nov  4 14:02:10 1988
  52. ***************
  53. *** 39,45 ****
  54.                   break;
  55.           }
  56.           for (; j >= nifs; nifs++) {
  57. !             bzero(&ifs[0], sizeof(ifs[j]));
  58.               strcpy(ifs[nifs].o0, ifreqs[i].ifr_name);
  59.               strcpy(ifrq.ifr_name, ifreqs[i].ifr_name);
  60.               if (ioctl(s, SIOCGIFFLAGS, &ifrq) < 0) {
  61. --- 39,46 ----
  62.                   break;
  63.           }
  64.           for (; j >= nifs; nifs++) {
  65. !             /* use offset of `j', not zero! */
  66. !             bzero(&ifs[j], sizeof(ifs[j]));
  67.               strcpy(ifs[nifs].o0, ifreqs[i].ifr_name);
  68.               strcpy(ifrq.ifr_name, ifreqs[i].ifr_name);
  69.               if (ioctl(s, SIOCGIFFLAGS, &ifrq) < 0) {
  70.  
  71.  
  72. *** main.c.old    Fri Nov  4 12:49:05 1988
  73. --- main.c    Fri Nov  4 12:49:26 1988
  74. ***************
  75. *** 67,73 ****
  76.       if (pgrp != 0) {
  77.           if (getpgrp(getpid()) == pgrp)
  78.               setpgrp(getpid(), getpid());
  79. !         kill(pgrp, SIGKILL);
  80.       }
  81.       doit();
  82.   }
  83. --- 67,73 ----
  84.       if (pgrp != 0) {
  85.           if (getpgrp(getpid()) == pgrp)
  86.               setpgrp(getpid(), getpid());
  87. +        /* they really want to kill the process group! */
  88. !         killpg(pgrp, SIGKILL);
  89.       }
  90.       doit();
  91.   }
  92.  
  93. *** fxread.c.old    Fri Nov  4 12:53:36 1988
  94. --- fxread.c    Fri Nov  4 12:54:49 1988
  95. ***************
  96. *** 5,11 ****
  97.   {
  98.       struct timeval tv;
  99.       int cnt, mask;
  100. !     int some_uninitialized_var;
  101.   
  102.       if (cnt = 0; cnt < buflen; ++cnt) {
  103.           mask = 1 << fd;
  104. --- 5,11 ----
  105.   {
  106.       struct timeval tv;
  107.       int cnt, mask;
  108. !     int some_uninitialized_var = use_lint_twit;
  109.   
  110.       if (cnt = 0; cnt < buflen; ++cnt) {
  111.           mask = 1 << fd;
  112.  
  113.  
  114. # This is a shell archive.  Save it in a file, remove anything before
  115. # this line, and then unpack it by entering "sh file".  Note, it may
  116. # create directories; files and directories will be owned by you and
  117. # have default permissions.
  118. #
  119. # This archive contains:
  120. #
  121. #    fingerd.8
  122. #    fingerd.c
  123. #    Makefile
  124. #
  125. echo x - fingerd.8
  126. sed 's/^X//' >fingerd.8 << 'END-of-fingerd.8'
  127. X.\" Copyright (c) 1980 The Regents of the University of California.
  128. X.\" All rights reserved.
  129. X.\"
  130. X.\" Redistribution and use in source and binary forms are permitted
  131. X.\" provided that the above copyright notice and this paragraph are
  132. X.\" duplicated in all such forms and that any documentation,
  133. X.\" advertising materials, and other materials related to such
  134. X.\" distribution and use acknowledge that the software was developed
  135. X.\" by the University of California, Berkeley.  The name of the
  136. X.\" University may not be used to endorse or promote products derived
  137. X.\" from this software without specific prior written permission.
  138. X.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  139. X.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  140. X.\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  141. X.\"
  142. X.\"    @(#)fingerd.8    6.2 (Berkeley) 9/19/88
  143. X.\"
  144. X.TH FINGERD 8 "September 19, 1988"
  145. X.UC 6
  146. X.SH NAME
  147. Xfingerd \- remote user information server
  148. X.SH SYNOPSIS
  149. X.B /etc/fingerd
  150. X.SH DESCRIPTION
  151. X.I Fingerd
  152. Xis a simple protocol based on RFC742 that provides an interface to the
  153. XName and Finger programs at several network sites.
  154. XThe program is supposed to return a friendly,
  155. Xhuman-oriented status report on either the system at the moment
  156. Xor a particular person in depth.
  157. XThere is no required format and the
  158. Xprotocol consists mostly of specifying a single ``command line''.
  159. X.PP
  160. X.I Fingerd
  161. Xlistens for TCP requests at port 79.
  162. XOnce connected it reads a single command line
  163. Xterminated by a <CRLF> which is passed to
  164. X.IR finger (1).
  165. X.I Fingerd
  166. Xcloses its connections as soon as the output is finished.
  167. X.PP
  168. XIf the line is null (i.e. just a <CRLF> is sent) then 
  169. X.I finger
  170. Xreturns a ``default'' report that lists all people logged into
  171. Xthe system at that moment.
  172. X.PP
  173. XIf a user name is specified (e.g. eric<CRLF>) then the
  174. Xresponse lists more extended information for only that particular user,
  175. Xwhether logged in or not.
  176. XAllowable ``names'' in the command line include both ``login names''
  177. Xand ``user names''.
  178. XIf a name is ambiguous, all possible derivations are returned.
  179. X.SH SEE ALSO
  180. Xfinger(1)
  181. X.SH BUGS
  182. XConnecting directly to the server from a TIP
  183. Xor an equally narrow-minded TELNET-protocol user program can result
  184. Xin meaningless attempts at option negotiation being sent to the
  185. Xserver, which will foul up the command line interpretation.
  186. X.I Fingerd
  187. Xshould be taught to filter out IAC's and perhaps even respond
  188. Xnegatively (IAC WON'T) to all option commands received.
  189. END-of-fingerd.8
  190. echo x - fingerd.c
  191. sed 's/^X//' >fingerd.c << 'END-of-fingerd.c'
  192. X/*
  193. X * Copyright (c) 1983 The Regents of the University of California.
  194. X * All rights reserved.
  195. X *
  196. X * Redistribution and use in source and binary forms are permitted
  197. X * provided that the above copyright notice and this paragraph are
  198. X * duplicated in all such forms and that any documentation,
  199. X * advertising materials, and other materials related to such
  200. X * distribution and use acknowledge that the software was developed
  201. X * by the University of California, Berkeley.  The name of the
  202. X * University may not be used to endorse or promote products derived
  203. X * from this software without specific prior written permission.
  204. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  205. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  206. X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  207. X */
  208. X
  209. X#ifndef lint
  210. Xchar copyright[] =
  211. X"@(#) Copyright (c) 1983 The Regents of the University of California.\n\
  212. X All rights reserved.\n";
  213. X#endif /* not lint */
  214. X
  215. X#ifndef lint
  216. Xstatic char sccsid[] = "@(#)fingerd.c    5.3 (Berkeley) 11/3/88";
  217. X#endif /* not lint */
  218. X
  219. X/*
  220. X * Finger server.
  221. X */
  222. X#include <sys/types.h>
  223. X#include <netinet/in.h>
  224. X#include <stdio.h>
  225. X#include <ctype.h>
  226. X
  227. Xmain(argc, argv)
  228. X    int argc;
  229. X    char *argv[];
  230. X{
  231. X    register char *sp;
  232. X    char line[512];
  233. X    struct sockaddr_in sin;
  234. X    int i, p[2], pid, status;
  235. X    FILE *fp;
  236. X    char *av[4];
  237. X
  238. X    i = sizeof (sin);
  239. X    if (getpeername(0, &sin, &i) < 0)
  240. X        fatal(argv[0], "getpeername");
  241. X    if (fgets(line, sizeof(line), stdin) == NULL)
  242. X        exit(1);
  243. X    sp = line;
  244. X    av[0] = "finger";
  245. X    for (i = 1;;) {
  246. X        while (isspace(*sp))
  247. X            sp++;
  248. X        if (!*sp)
  249. X            break;
  250. X        if (*sp == '/' && (sp[1] == 'W' || sp[1] == 'w')) {
  251. X            sp += 2;
  252. X            av[i++] = "-l";
  253. X        }
  254. X        if (*sp && !isspace(*sp)) {
  255. X            av[i++] = sp;
  256. X            while (*sp && !isspace(*sp))
  257. X                sp++;
  258. X            *sp = '\0';
  259. X        }
  260. X    }
  261. X    av[i] = 0;
  262. X    if (pipe(p) < 0)
  263. X        fatal(argv[0], "pipe");
  264. X    if ((pid = fork()) == 0) {
  265. X        close(p[0]);
  266. X        if (p[1] != 1) {
  267. X            dup2(p[1], 1);
  268. X            close(p[1]);
  269. X        }
  270. X        execv("/usr/ucb/finger", av);
  271. X        _exit(1);
  272. X    }
  273. X    if (pid == -1)
  274. X        fatal(argv[0], "fork");
  275. X    close(p[1]);
  276. X    if ((fp = fdopen(p[0], "r")) == NULL)
  277. X        fatal(argv[0], "fdopen");
  278. X    while ((i = getc(fp)) != EOF) {
  279. X        if (i == '\n')
  280. X            putchar('\r');
  281. X        putchar(i);
  282. X    }
  283. X    fclose(fp);
  284. X    while ((i = wait(&status)) != pid && i != -1)
  285. X        ;
  286. X    return(0);
  287. X}
  288. X
  289. Xfatal(prog, s)
  290. X    char *prog, *s;
  291. X{
  292. X    fprintf(stderr, "%s: ", prog);
  293. X    perror(s);
  294. X    exit(1);
  295. X}
  296. END-of-fingerd.c
  297. echo x - Makefile
  298. sed 's/^X//' >Makefile << 'END-of-Makefile'
  299. X#
  300. X# Copyright (c) 1988 Regents of the University of California.
  301. X# All rights reserved.
  302. X#
  303. X# Redistribution and use in source and binary forms are permitted
  304. X# provided that the above copyright notice and this paragraph are
  305. X# duplicated in all such forms and that any documentation, advertising
  306. X# materials, and other materials related to such redistribution and
  307. X# use acknowledge that the software was developed by the University
  308. X# of California, Berkeley.  The name of the University may not be
  309. X# used to endorse or promote products derived from this software
  310. X# without specific prior written permission.  THIS SOFTWARE IS PROVIDED
  311. X# ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
  312. X# WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
  313. X# FITNESS FOR A PARTICULAR PURPOSE.
  314. X#
  315. X# @(#)Makefile    5.1 (Berkeley) 9/19/88
  316. X#
  317. X
  318. XCFLAGS=    -O
  319. XLIBC=    /lib/libc.a
  320. XSRCS=    fingerd.c
  321. XOBJS=
  322. XMAN=    fingerd.0
  323. X
  324. Xall: fingerd
  325. X
  326. Xfingerd: ${LIBC}
  327. X    ${CC} -o $@ ${CFLAGS} $@.c
  328. X
  329. Xclean:
  330. X    rm -f ${OBJS} core fingerd
  331. X
  332. Xcleandir: clean
  333. X    rm -f ${MAN} tags .depend
  334. X
  335. Xdepend: ${SRCS}
  336. X    mkdep -p ${CFLAGS} ${SRCS}
  337. X
  338. Xinstall: ${MAN}
  339. X    install -s -o bin -g bin -m 755 fingerd ${DESTDIR}/etc/fingerd
  340. X    install -c -o bin -g bin -m 444 fingerd.0 ${DESTDIR}/usr/man/cat8
  341. X
  342. Xlint: ${SRCS}
  343. X    lint ${CFLAGS} ${SRCS}
  344. X
  345. Xtags: ${SRCS}
  346. X    ctags ${SRCS}
  347. END-of-Makefile
  348. exit
  349.